package com.ayz.gateway.core.datasource;

import com.ayz.gateway.core.rpc.RemotingResponseCallback;
import lombok.Data;

/**
 * @ClassName RpcStatement
 * @Description TODO: 当前类是封装一次RPC调用所需的参数集合
 * @Author 快乐的星球
 * @Date 2023/5/8 23:12
 * @Version 1.0
 **/
@Data
public class RpcStatement {
    /**
     * 服务的名称
     */
    private String applicationName;
    /**
     * 接口的名称
     */
    private String interfaceName;
    /**
     * 方法的名称
     */
    private String methodName;
    /**
     * 参数类型名称列表
     */
    private String[] parameterTypeNames;
    /**
     * 参数类型数组
     */
    private Class<?>[] parameterTypes;
    /**
     * 参数列表
     */
    private Object[] args;
    /**
     * 是同步还是异步的发起RPC调用
     * 需要第三方RPC框架支持同步或异步否则会出错
     */
    private boolean isSync;

    /**
     * 发起RPC调用返回结果后的响应回调处理函数
     */
    private RemotingResponseCallback responseCallback;
    /**
     * 数据源工厂
     */
    private DatasourceFactory datasourceFactory;


    public RpcStatement() {
    }

    public RpcStatement(String applicationName, String interfaceName, String methodName, String[] parameterTypeNames, Class<?>[] parameterTypes, Object[] args, boolean isSync, RemotingResponseCallback responseCallback) {
        this.applicationName = applicationName;
        this.interfaceName = interfaceName;
        this.methodName = methodName;
        this.parameterTypeNames = parameterTypeNames;
        this.parameterTypes = parameterTypes;
        this.args = args;
        this.isSync = isSync;
        this.responseCallback = responseCallback;
    }
}
